package test.h0816;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.StringJoiner;
/**
  * @description 字符串分割II2
  * @author 不知名帅哥
  * @date 2024/8/16 14:58
  * @version 1.0
*/
public class Main1 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String s = sc.nextLine();
        int k=Integer.parseInt(s);
        String str = sc.nextLine();
        getResult(str,k);
    }

    private static void getResult(String str, int k) {
        //思路： 首先排除第一个子串，然后将后面的子串合并到一起，然后按照每k个分割。
        //再写个转换大小写的方法。
        String[] split = str.split("-");
        StringBuilder builder = new StringBuilder();
        for (int i = 1; i <split.length ; i++) {
            builder.append(split[i]);
        }
        String temp= builder.toString();
        List<String> list=new ArrayList<>();
        for (int i = 0; i < temp.length(); i+=k) {
            String s;
            if (i+k>temp.length()){
                 s=temp.substring(i);
            }else {
                s=temp.substring(i,i+k);
            }
            list.add(convert(s));
        }
        StringJoiner joiner=new StringJoiner("-");
        joiner.add(split[0]);
        for (String s : list) {
            joiner.add(s);
        }
        System.out.println(joiner);
    }

    //转换器
    private static String convert(String s) {
        int n = s.length();
        int upperCount=0;
        int lowerCount=0;
        for (int i = 0; i < n; i++) {
            if (Character.isUpperCase(s.charAt(i))){
                upperCount++;
            }
            else if (Character.isLowerCase(s.charAt(i))){
                lowerCount++;
            }else {
                continue;
            }
        }
        if (upperCount==lowerCount){
            return s;
        }else return upperCount>lowerCount?s.toUpperCase():s.toLowerCase();
    }
}
